<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生信息管理 - 学生信息管理系统</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="container">
            <a href="index.jsp" class="navbar-brand">学生信息管理系统</a>
            <ul class="navbar-menu">
                <li><a href="index.jsp">首页</a></li>
                <li><a href="student-management.jsp">学生管理</a></li>
                <li><a href="class-management.jsp">班级管理</a></li>
                <li><a href="score-management.jsp">成绩管理</a></li>
                <li><a href="#" onclick="alert('退出登录'); return false;">退出登录</a></li>
            </ul>
        </div>
    </nav>
    
    <div class="container">
        <h1>学生信息管理</h1>
        
        <!-- 显示消息提示 -->
        <% if (request.getAttribute("message") != null) { %>
            <div class="message success">
                <%= request.getAttribute("message") %>
            </div>
        <% } %>
        
        <% if (request.getAttribute("error") != null) { %>
            <div class="message error">
                <%= request.getAttribute("error") %>
            </div>
        <% } %>
        
        <!-- 搜索和添加区域 -->
        <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
            <div style="display: flex; gap: 10px; flex: 1; max-width: 500px;">
                <input type="text" id="searchInput" placeholder="搜索学生姓名、学号或班级" style="flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 4px;">
                <select id="searchType" style="padding: 10px; border: 1px solid #ddd; border-radius: 4px;">
                    <option value="all">全部</option>
                    <option value="name">姓名</option>
                    <option value="studentId">学号</option>
                    <option value="class">班级</option>
                </select>
                <button class="btn btn-primary" onclick="searchStudent()">搜索</button>
            </div>
            <div>
                <a href="student-form.jsp" class="btn btn-success">添加学生</a>
                <button class="btn btn-secondary" onclick="showMessage('导出功能开发中', 'info')">导出数据</button>
            </div>
        </div>
        
        <!-- 筛选条件 -->
        <div style="background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); margin-bottom: 20px;">
            <div style="display: flex; flex-wrap: wrap; gap: 15px; align-items: center;">
                <div>
                    <label for="gradeFilter">年级：</label>
                    <select id="gradeFilter" style="padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
                        <option value="">全部</option>
                        <option value="2020">2020级</option>
                        <option value="2021">2021级</option>
                        <option value="2022">2022级</option>
                        <option value="2023">2023级</option>
                    </select>
                </div>
                <div>
                    <label for="majorFilter">专业：</label>
                    <select id="majorFilter" style="padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
                        <option value="">全部</option>
                        <option value="computer">计算机科学与技术</option>
                        <option value="software">软件工程</option>
                        <option value="network">网络工程</option>
                        <option value="ai">人工智能</option>
                    </select>
                </div>
                <div>
                    <label for="classFilter">班级：</label>
                    <select id="classFilter" style="padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
                        <option value="">全部</option>
                        <option value="1">1班</option>
                        <option value="2">2班</option>
                        <option value="3">3班</option>
                        <option value="4">4班</option>
                    </select>
                </div>
                <div>
                    <label for="genderFilter">性别：</label>
                    <select id="genderFilter" style="padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
                        <option value="">全部</option>
                        <option value="male">男</option>
                        <option value="female">女</option>
                    </select>
                </div>
                <button class="btn btn-secondary" onclick="applyFilters()">应用筛选</button>
                <button class="btn btn-secondary" onclick="resetFilters()">重置筛选</button>
            </div>
        </div>
        
        <!-- 学生列表 -->
        <div class="table-container">
            <table>
                <thead>
                    <tr>
                        <th><input type="checkbox" id="selectAll"></th>
                        <th>学号</th>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>年龄</th>
                        <th>班级</th>
                        <th>专业</th>
                        <th>出生日期</th>
                        <th>联系方式</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><input type="checkbox" class="student-checkbox" value="202301001"></td>
                        <td>202301001</td>
                        <td>张三</td>
                        <td>男</td>
                        <td>18</td>
                        <td>计算机科学与技术1班</td>
                        <td>计算机科学与技术</td>
                        <td>2005-05-15</td>
                        <td>13800138001</td>
                        <td>
                            <a href="student-form.jsp?id=202301001" class="btn btn-primary" style="padding: 5px 10px; font-size: 14px;">编辑</a>
                            <a href="#" onclick="confirmDeleteStudent('202301001')" class="btn btn-danger" style="padding: 5px 10px; font-size: 14px;">删除</a>
                            <a href="student-detail.jsp?id=202301001" class="btn btn-secondary" style="padding: 5px 10px; font-size: 14px;">详情</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="student-checkbox" value="202301002"></td>
                        <td>202301002</td>
                        <td>李四</td>
                        <td>女</td>
                        <td>19</td>
                        <td>计算机科学与技术1班</td>
                        <td>计算机科学与技术</td>
                        <td>2004-11-23</td>
                        <td>13800138002</td>
                        <td>
                            <a href="student-form.jsp?id=202301002" class="btn btn-primary" style="padding: 5px 10px; font-size: 14px;">编辑</a>
                            <a href="#" onclick="confirmDeleteStudent('202301002')" class="btn btn-danger" style="padding: 5px 10px; font-size: 14px;">删除</a>
                            <a href="student-detail.jsp?id=202301002" class="btn btn-secondary" style="padding: 5px 10px; font-size: 14px;">详情</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="student-checkbox" value="202301003"></td>
                        <td>202301003</td>
                        <td>王五</td>
                        <td>男</td>
                        <td>18</td>
                        <td>软件工程2班</td>
                        <td>软件工程</td>
                        <td>2005-08-07</td>
                        <td>13800138003</td>
                        <td>
                            <a href="student-form.jsp?id=202301003" class="btn btn-primary" style="padding: 5px 10px; font-size: 14px;">编辑</a>
                            <a href="#" onclick="confirmDeleteStudent('202301003')" class="btn btn-danger" style="padding: 5px 10px; font-size: 14px;">删除</a>
                            <a href="student-detail.jsp?id=202301003" class="btn btn-secondary" style="padding: 5px 10px; font-size: 14px;">详情</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="student-checkbox" value="202301004"></td>
                        <td>202301004</td>
                        <td>赵六</td>
                        <td>男</td>
                        <td>19</td>
                        <td>网络工程3班</td>
                        <td>网络工程</td>
                        <td>2004-03-12</td>
                        <td>13800138004</td>
                        <td>
                            <a href="student-form.jsp?id=202301004" class="btn btn-primary" style="padding: 5px 10px; font-size: 14px;">编辑</a>
                            <a href="#" onclick="confirmDeleteStudent('202301004')" class="btn btn-danger" style="padding: 5px 10px; font-size: 14px;">删除</a>
                            <a href="student-detail.jsp?id=202301004" class="btn btn-secondary" style="padding: 5px 10px; font-size: 14px;">详情</a>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" class="student-checkbox" value="202301005"></td>
                        <td>202301005</td>
                        <td>钱七</td>
                        <td>女</td>
                        <td>18</td>
                        <td>人工智能1班</td>
                        <td>人工智能</td>
                        <td>2005-09-28</td>
                        <td>13800138005</td>
                        <td>
                            <a href="student-form.jsp?id=202301005" class="btn btn-primary" style="padding: 5px 10px; font-size: 14px;">编辑</a>
                            <a href="#" onclick="confirmDeleteStudent('202301005')" class="btn btn-danger" style="padding: 5px 10px; font-size: 14px;">删除</a>
                            <a href="student-detail.jsp?id=202301005" class="btn btn-secondary" style="padding: 5px 10px; font-size: 14px;">详情</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        
        <!-- 分页 -->
        <div style="display: flex; justify-content: space-between; align-items: center; margin-top: 20px;">
            <div>
                显示 <strong>1-5</strong> 条，共 <strong>256</strong> 条记录
            </div>
            <div class="pagination">
                <a href="#" onclick="changePage(1)">首页</a>
                <a href="#" onclick="changePage(0)" class="disabled">上一页</a>
                <a href="#" onclick="changePage(1)" class="active">1</a>
                <a href="#" onclick="changePage(2)">2</a>
                <a href="#" onclick="changePage(3)">3</a>
                <span>...</span>
                <a href="#" onclick="changePage(51)">51</a>
                <a href="#" onclick="changePage(2)">下一页</a>
                <a href="#" onclick="changePage(51)">末页</a>
            </div>
        </div>
    </div>
    
    <script src="js/script.js"></script>
</body>
</html>